/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package trumpet.core;

/**
 *
 * @author Artur
 */
public class User {

    
    public static enum Gener {

        MALE("Mężczyna"), FEMALE("Kobieta"), NOT_SPECIFIED("-");
        private String title;

        Gener(String t) {
            this.title = t;
        }
        @Override
        public String toString() {
            return title;
        }
        public String getTitle() {
            return title;
        }
    }
    private Integer id;
    private String name;
    private String surname;
    private String ip;
    private Gener gener;

    public User(String name, String surname, String ipaddress) {
        this.name = name;
        this.surname = surname;
        this.ip = ipaddress;
        this.gener = Gener.MALE;
    }
    public User() {
        
    }
    @Override
    public String toString() {
        return this.getName() + " "
                + this.getSurname()
                + "[" + this.getIp() + "]";
    }
    public boolean hasId() {
        if(this.id == null) {
            return false;
        }
        return true;
    }
    /**
     * @return the id
     */
    public Integer getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(Integer id) {
        this.id = id;
    }
    /**
     * @return the name
     */
    public String getName() {
        return name;
    }
    
    /**
     * @return the full name (name + surname)
     */
    public String getFullName() {
        return name + (surname instanceof String ? " " + surname : "");
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the surname
     */
    public String getSurname() {
        return surname;
    }

    /**
     * @param surname the surname to set
     */
    public void setSurname(String surname) {
        this.surname = surname;
    }

    /**
     * @return the ip
     */
    public String getIp() {
        return ip;
    }

    /**
     * @param ip the ip to set
     */
    public void setIp(String ip) {
        this.ip = ip;
    }

    /**
     * @return the gener
     */
    public Gener getGener() {
        return gener;
    }
    
    /**
     * @param gener the gener to set
     */
    public void setGener(Gener gener) {
        this.gener = gener;
    }
    public void setGener(String textContent) {
        if(textContent.equals(Gener.FEMALE.toString())) {
            this.gener = Gener.FEMALE;
        } else if(textContent.equals(Gener.MALE.toString())) {
            this.gener = Gener.MALE;
        } else {
            this.gener = Gener.NOT_SPECIFIED;
        }
    }
}
